export class StateMachine {

    currentState: State;

    changeState(state: State) {
        if (this.currentState) {
            this.currentState.onExit();
        }
        this.currentState = state;
        this.currentState.onEnter();

    }
}


export abstract class State {

    abstract onEnter();

    abstract onExit();
}